package com.hung.triple.heartbeat;

import com.hung.triple.protocol.rpc.TripleRpcResponse;

import java.net.InetSocketAddress;

/**
 * @author Hung
 * @date 2023/2/7 23:13
 */
public class RpcCommandFactory implements CommandFactory {
    public RpcCommandFactory() {
    }

    @Override
    public TripleRpcResponse createTimeoutResponse(InetSocketAddress address) {
        TripleRpcResponse response = new TripleRpcResponse();
        response.setCode(TripleRpcResponse.TIMEOUT);
        response.setResponseHost(address);
        return response;
    }


    @Override
    public TripleRpcResponse createSuccessResponse(InetSocketAddress address) {
        TripleRpcResponse response = new TripleRpcResponse();
        response.setCode(TripleRpcResponse.SUCCESS);
        response.setResponseHost(address);
        return response;
    }
}
